package cn.sciento.starter.social.sina.connection;

import cn.sciento.starter.social.core.common.api.SocialApi;
import cn.sciento.starter.social.core.common.connect.SocialApiAdapter;
import cn.sciento.starter.social.sina.api.SinaUser;
import org.springframework.social.connect.ConnectionValues;

public class SinaApiAdapter extends SocialApiAdapter {
  public SinaApiAdapter() {}
  
  public SinaApiAdapter(String providerUserId) {
    super(providerUserId);
  }
  
  public void setConnectionValues(SocialApi api, ConnectionValues values) {
    SinaUser user = (SinaUser)api.getUser(getProviderUserId());
    values.setDisplayName(user.getScreen_name());
    values.setImageUrl(user.getProfile_image_url());
    values.setProviderUserId(user.getIdstr());
  }
}
